﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dapper.Logic.Service;

namespace Dapper.Logic.Implement
{
    public class AcitonLogicImpl : IActionLogicService
    {

        public List<TRet> Fetch<T1, T2, TRet>(Func<T1, T2, TRet> cb, string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2, TRet>(cb, sql, args);
        }

        public List<TRet> Fetch<T1, T2, T3, TRet>(Func<T1, T2, T3, TRet> cb, string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2, T3, TRet>(cb, sql, args);
        }

        public List<TRet> Fetch<T1, T2, T3, T4, TRet>(Func<T1, T2, T3, T4, TRet> cb, string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2, T3, T4, TRet>(cb, sql, args);
        }

        public IEnumerable<TRet> Query<T1, T2, TRet>(Func<T1, T2, TRet> cb, string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2, TRet>(cb, sql, args);
        }

        public IEnumerable<TRet> Query<T1, T2, T3, TRet>(Func<T1, T2, T3, TRet> cb, string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2, T3, TRet>(cb, sql, args);
        }

        public IEnumerable<TRet> Query<T1, T2, T3, T4, TRet>(Func<T1, T2, T3, T4, TRet> cb, string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2, T3, T4, TRet>(cb, sql, args);
        }

        public List<TRet> Fetch<T1, T2, TRet>(Func<T1, T2, TRet> cb, Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2, TRet>(cb, sql);
        }

        public List<TRet> Fetch<T1, T2, T3, TRet>(Func<T1, T2, T3, TRet> cb, Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2, T3, TRet>(cb, sql);
        }

        public List<TRet> Fetch<T1, T2, T3, T4, TRet>(Func<T1, T2, T3, T4, TRet> cb, Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2, T3, T4, TRet>(cb, sql);
        }

        public IEnumerable<TRet> Query<T1, T2, TRet>(Func<T1, T2, TRet> cb, Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2, TRet>(cb, sql);
        }

        public IEnumerable<TRet> Query<T1, T2, T3, TRet>(Func<T1, T2, T3, TRet> cb, Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2, T3, TRet>(cb, sql);
        }

        public IEnumerable<TRet> Query<T1, T2, T3, T4, TRet>(Func<T1, T2, T3, T4, TRet> cb, Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2, T3, T4, TRet>(cb, sql);
        }

        public List<T1> Fetch<T1, T2>(string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2>(sql, args);
        }

        public List<T1> Fetch<T1, T2, T3>(string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2, T3>(sql, args);
        }

        public List<T1> Fetch<T1, T2, T3, T4>(string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2, T3, T4>(sql, args);
        }

        public IEnumerable<T1> Query<T1, T2>(string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2>(sql, args);
        }

        public IEnumerable<T1> Query<T1, T2, T3>(string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2, T3>(sql, args);
        }

        public IEnumerable<T1> Query<T1, T2, T3, T4>(string sql, params object[] args)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2, T3, T4>(sql, args);
        }

        public List<T1> Fetch<T1, T2>(Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2>(sql);
        }

        public List<T1> Fetch<T1, T2, T3>(Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2, T3>(sql);
        }

        public List<T1> Fetch<T1, T2, T3, T4>(Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Fetch<T1, T2, T3, T4>(sql);
        }

        public IEnumerable<T1> Query<T1, T2>(Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2>(sql);
        }

        public IEnumerable<T1> Query<T1, T2, T3>(Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2, T3>(sql);
        }

        public IEnumerable<T1> Query<T1, T2, T3, T4>(Orm.Sql sql)
        {
            return Dapper.Data.DateService.IActionDateService.Query<T1, T2, T3, T4>(sql);
        }
    }

    public class ActionLogicImpl<T> : IActionLogicService<T> where T : new()
    {
        public bool IsNew(T modle)
        {
            return Data.DateService<T>.IActionDateService.IsNew(modle);
        }

        public object Insert(T modle)
        {
            return Data.DateService<T>.IActionDateService.Insert(modle);
        }

        public void Save(T modle)
        {
            Data.DateService<T>.IActionDateService.Save(modle);
        }

        public int Update(T modle)
        {
            return Data.DateService<T>.IActionDateService.Update(modle);
        }

        public int Update(T modle, IEnumerable<string> columns)
        {
            return Data.DateService<T>.IActionDateService.Update(modle, columns);
        }

        public int Update(string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.Update(sql, args);
        }

        public int Update(Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.Update(sql);
        }

        public int Delete(T modle)
        {
            return Data.DateService<T>.IActionDateService.Delete(modle);
        }

        public int Delete(string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.Delete(sql, args);
        }

        public int Delete(Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.Delete(sql);
        }

        public int Delete(object primaryKey)
        {
            return Data.DateService<T>.IActionDateService.Delete(primaryKey);
        }

        public bool Exists(object primaryKey)
        {
            return Data.DateService<T>.IActionDateService.Exists(primaryKey);
        }

        public T SingleOrDefault(object primaryKey)
        {
            return Data.DateService<T>.IActionDateService.SingleOrDefault(primaryKey);
        }

        public T SingleOrDefault(string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.SingleOrDefault(sql, args);
        }

        public T SingleOrDefault(Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.SingleOrDefault(sql);
        }

        public T FirstOrDefault(string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.FirstOrDefault(sql, args);
        }

        public T FirstOrDefault(Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.FirstOrDefault(sql);
        }

        public T Single(object primaryKey)
        {
            return Data.DateService<T>.IActionDateService.Single(primaryKey);
        }

        public T Single(string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.Single(sql, args);
        }

        public T Single(Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.Single(sql);
        }

        public T First(string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.First(sql, args);
        }

        public T First(Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.First(sql);
        }

        public List<T> Fetch(string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.Fetch(sql, args);
        }

        public List<T> Fetch(Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.Fetch(sql);
        }

        public List<T> Fetch(long page, long itemsPerPage, string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.Fetch(page, itemsPerPage, sql, args);
        }

        public List<T> Fetch(long page, long itemsPerPage, Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.Fetch(page, itemsPerPage, sql);
        }

        public List<T> SkipTake(long skip, long take, string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.SkipTake(skip, take, sql, args);
        }

        public List<T> SkipTake(long skip, long take, Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.SkipTake(skip, take, sql);
        }

        public Orm.Page<T> Page(long page, long itemsPerPage, string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.Page(page, itemsPerPage, sql, args);
        }

        public Orm.Page<T> Page(long page, long itemsPerPage, Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.Page(page, itemsPerPage, sql);
        }

        public IEnumerable<T> Query(string sql, params object[] args)
        {
            return Data.DateService<T>.IActionDateService.Query(sql, args);
        }

        public IEnumerable<T> Query(Orm.Sql sql)
        {
            return Data.DateService<T>.IActionDateService.Query(sql);
        }

    }
}
